package com.iweb.newa202104.exception;


import com.iweb.newa202104.util.CommonUtil;
import com.iweb.newa202104.vo.ResultVO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: LGZ
 * @Date: 2021/1/27 16:57
 * @Description: 异常处理
 */
@ControllerAdvice
public class CommonExceptionHandler {
    @ExceptionHandler(value = CommonException.class)
    @ResponseBody
    public ResultVO error(CommonException e) {
        return CommonUtil.ajaxReturn(e.getCode(), e.getMessage());
    }
}
